using System;
using System.Collections.Generic;
using System.Text;

namespace Hermes.Framework.Implementation.Directory
{
    public class TxDirectoryMove : TxOperationTemplate, ITransactableMove
    {
        public TxDirectoryMove(string from, string to) : base(from, to)
        {

        }

        public void Move()
        {
            TxDirectoryCopy copy = new TxDirectoryCopy(srcFileName, dstFileName);
            copy.Copy();

            TxDirectoryDelete delete = new TxDirectoryDelete(srcFileName);
            delete.Delete();
        }

        protected override void Operate()
        {
            this.Move();
        }

        public override void Commit()
        {
            // does nothing...
        }

        public override void Rollback()
        {
            // does nothing...
        }
    }
}
